package com.share.design.status;

/**
 * author:caifan
 * date:2020/2/5
 */
public abstract class AbstractState {
    ScoreContext context;
    protected String stateName;
    protected int score = 0;

    public abstract void checkState();//检查状态

    public void addScore(int x) {
        score += x;
        System.out.print("加上："+x+"分，\t当前分数：" + score );
        checkState();
        System.out.println("分，\t当前状态："+ context.getState().stateName);
    }
}
